package com.cyy.springbootinit.model.vo;

import cn.hutool.json.JSONUtil;
import com.cyy.springbootinit.model.entity.BalanceAlarm;
import com.cyy.springbootinit.model.entity.EquipmentInfo;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 余额报警记录表视图
 *
 * @author 程序员cyy</a>
 * @from cyy</a>
 */
@Data
public class BalanceAlarmVO implements Serializable {

    /**
     * id
     */
    private Integer id;

    /**
     *
     */
    private Integer dormitoryId;

    /**
     *
     */
    private Integer equipmentId;

    //是否处理
    private Integer isSolved;
    //报警日期
    private Date alarmDate;

    private EquipmentInfo equipmentInfo;
    /**
     *
     */
    private String note;

    /**
     *
     */
    private Double deviceBalance;
    private static final long serialVersionUID = 1L;

    /**
     * 封装类转对象
     *
     * @param balanceAlarmVO
     * @return
     */
    public static BalanceAlarm voToObj(BalanceAlarmVO balanceAlarmVO) {
        if (balanceAlarmVO == null) {
            return null;
        }
        BalanceAlarm balanceAlarm = new BalanceAlarm();
        BeanUtils.copyProperties(balanceAlarmVO, balanceAlarm);
        return balanceAlarm;
    }

    /**
     * 对象转封装类
     *
     * @param balanceAlarm
     * @return
     */
    public static BalanceAlarmVO objToVo(BalanceAlarm balanceAlarm) {
        if (balanceAlarm == null) {
            return null;
        }
        BalanceAlarmVO balanceAlarmVO = new BalanceAlarmVO();
        BeanUtils.copyProperties(balanceAlarm, balanceAlarmVO);
        return balanceAlarmVO;
    }
}
